﻿Imports System.Data
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data.OleDb
Imports System
Imports System.Globalization


Partial Class Interfaz_VisualizaPresupuesto
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       
    End Sub

#Region "Funciones"
  
#End Region

#Region "Botones"
   
#End Region

#Region "Eventos"
#Region "Eventos"

    Protected Sub GridSubProyectos_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
        GridSubProyectos.PageIndex = e.NewPageIndex
        'Bind data to the GridView control.
        BindData("SubProyecto")
    End Sub

    Protected Sub GridSubProyectos_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs)
        'Set the edit index.
        GridSubProyectos.EditIndex = e.NewEditIndex
        'Bind data to the GridView control.
        BindData("SubProyecto")
    End Sub

    Protected Sub GridSubProyectos_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs)
        'Reset the edit index.
        GridSubProyectos.EditIndex = -1
        'Bind data to the GridView control.
        BindData("SubProyecto")
    End Sub

    Protected Sub GridSubProyectos_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs)
        'Retrieve the table from the session object.
        Dim dt As DataTable = CType(Session("SubProyecto"), DataTable)

        'Update the values.
        Dim row As GridViewRow = GridSubProyectos.Rows(e.RowIndex)

        dt.Rows(row.DataItemIndex)("SUBPROYECTO") = (CType((row.Cells(1).Controls(0)), TextBox)).Text
        dt.Rows(row.DataItemIndex)("DESCRIPCION") = (CType((row.Cells(2).Controls(0)), TextBox)).Text
        dt.Rows(row.DataItemIndex)("OBSTALLER") = (CType((row.Cells(3).Controls(0)), TextBox)).Text
        dt.Rows(row.DataItemIndex)("NOTASCLIENTE") = (CType((row.Cells(4).Controls(0)), TextBox)).Text
        dt.Rows(row.DataItemIndex)("NOTASVENTAS") = (CType((row.Cells(5).Controls(0)), TextBox)).Text
        'Reset the edit index.
        GridSubProyectos.EditIndex = -1

        'Bind data to the GridView control.
        BindData("SubProyecto")
    End Sub

    Sub GridSubProyectos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs)
        Dim dt As DataTable = CType(Session("SubProyecto"), DataTable)
        dt.Rows(e.RowIndex).Delete()
        GridSubProyectos.DataSource = dt
        GridSubProyectos.DataBind()
    End Sub

    Private Sub BindData(ByVal nombreGrid As String)
        GridSubProyectos.DataSource = Session(nombreGrid)
        GridSubProyectos.DataBind()
    End Sub


#End Region
#End Region
    

    
End Class
